package com.shine.icis.hbean;

import java.io.Serializable;
import java.text.DecimalFormat;
import java.util.Date;

import org.apache.struts2.json.annotations.JSON;

import com.shine.icis.config.SysCodeDictLoader;

public class RptA13Bak implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 3662405149335236166L;
	
	public static final String OPTYPE_ADD = "add";
	public static final String OPTYPE_DEL = "delete";
	
	private DecimalFormat doubleFormat = new DecimalFormat("0.00");
	private int id;
	private String companyCode;// 证监会确定的证券公司机构编码
	private String tradeDate;// 交易日期
	private String arapType;// 应收应付类型
	private String oppPar;// 对方机构
	private String mktCodeSipf;// 市场代码
	private String curTypeSipf;// 币种类别
	private String arapBusiType;// 业务类型
	private String harapDate;// 已收付日期
	private String arapReason;// 应收付原因
	private double arapAmt;// 应收应付金额
	private String arapDate;// 应收付日期
	private String summary;// 摘要信息
	private String busiDate;// 业务日期
	private Date oprDateTime;//操作日期
    private String oprCode;  //操作代码
    private String opType; //操作类型 (add/delete/modify)
	
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getCompanyCode() {
		return companyCode;
	}

	public void setCompanyCode(String companyCode) {
		this.companyCode = companyCode;
	}

	public String getTradeDate() {
		return tradeDate;
	}

	public void setTradeDate(String tradeDate) {
		this.tradeDate = tradeDate;
	}

	public String getArapType() {
		return arapType;
	}

	public void setArapType(String arapType) {
		this.arapType = arapType;
	}

	public String getOppPar() {
		return oppPar;
	}

	public void setOppPar(String oppPar) {
		this.oppPar = oppPar;
	}

	public String getMktCodeSipf() {
		return mktCodeSipf;
	}

	public void setMktCodeSipf(String mktCodeSipf) {
		this.mktCodeSipf = mktCodeSipf;
	}

	public String getCurTypeSipf() {
		return curTypeSipf;
	}

	public void setCurTypeSipf(String curTypeSipf) {
		this.curTypeSipf = curTypeSipf;
	}

	public String getArapBusiType() {
		return arapBusiType;
	}

	public void setArapBusiType(String arapBusiType) {
		this.arapBusiType = arapBusiType;
	}

	public String getHarapDate() {
		return harapDate;
	}

	public void setHarapDate(String harapDate) {
		this.harapDate = harapDate;
	}

	public String getArapReason() {
		return arapReason;
	}

	public void setArapReason(String arapReason) {
		this.arapReason = arapReason;
	}

	public double getArapAmt() {
		return arapAmt;
	}
	public String getArapAmtText() {
		return doubleFormat.format(arapAmt);
	}
	public void setArapAmt(double arapAmt) {
		this.arapAmt = arapAmt;
	}

	public String getArapDate() {
		return arapDate;
	}

	public void setArapDate(String arapDate) {
		this.arapDate = arapDate;
	}

	public String getSummary() {
		return summary;
	}

	public void setSummary(String summary) {
		this.summary = summary;
	}

	public String getBusiDate() {
		return busiDate;
	}

	public void setBusiDate(String busiDate) {
		this.busiDate = busiDate;
	}

	@JSON(format="yyyy-MM-dd HH:mm")
	public Date getOprDateTime() {
		return oprDateTime;
	}

	public void setOprDateTime(Date oprDateTime) {
		this.oprDateTime = oprDateTime;
	}

	public String getOprCode() {
		return oprCode;
	}

	public void setOprCode(String oprCode) {
		this.oprCode = oprCode;
	}

	public String getOpType() {
		return opType;
	}

	public void setOpType(String opType) {
		this.opType = opType;
	}
	
	public String getFormatTradeDate() {
		StringBuffer date = new StringBuffer(tradeDate);
		date.insert(6, "-").insert(4, "-");
		return date.toString();
	}
	public String getFormatHarapDate() {
		StringBuffer date = new StringBuffer(harapDate);
		date.insert(6, "-").insert(4, "-");
		return date.toString();
	}
	public String getFormatArapDate() {
		if (arapDate == null) {
			return "";
		}
		StringBuffer date = new StringBuffer(arapDate);
		date.insert(6, "-").insert(4, "-");
		return date.toString();
	}
	public String getFormatBusiDate() {
		StringBuffer date = new StringBuffer(busiDate);
		date.insert(6, "-").insert(4, "-");
		return date.toString();
	}
	public String getArapTypeText() {
		return arapType + ":" + SysCodeDictLoader.getInstance().getArapTypeConfText(arapType);
	}
	
	public String getArapReasonText() {
		return arapReason + ":" + SysCodeDictLoader.getInstance().getArapReasonConfText(arapReason);
	}
	
	public String getCurTypeSipfText() {
		return curTypeSipf + ":" + SysCodeDictLoader.getInstance().getCurTypeSipfConfText(curTypeSipf);
	}
	
	public String getOppParText() {
		String tem = SysCodeDictLoader.getInstance().getOppParConfText(oppPar);
		return tem != null ? (oppPar+ ":" + tem) : ("TA代码:" + oppPar);
	}
	
	public String getMktCodeSipfText() {
		return mktCodeSipf + ":" + SysCodeDictLoader.getInstance().getMktCodeSipfConfText(mktCodeSipf);
	}
	
	public String getArapBusiTypeText() {
		return arapBusiType + ":" + SysCodeDictLoader.getInstance().getArapBusiTypeConfText(arapBusiType);
	}
	
	public String getOpTypeText() {
		if (OPTYPE_ADD.equals(opType)) {
			return "新增";
//		} else if ("modify".equals(opType)) {
//			return "修改";
		} else if (OPTYPE_DEL.equals(opType)) {
			return "删除";
		}
		return opType;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final RptA13Bak other = (RptA13Bak) obj;
		if (id != other.id)
			return false;
		return true;
	}
}
